<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:fb="http://www.facebook.com/2008/fbml">
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
        <title></title>
        <style type="text/css">
            html
            {
              font-size: 12px;
              font-family: Arial;
              color: #5F5F5F;
            }
            a{
                text-decoration: none;
                color: blue;
            }
            a:hover{
                text-decoration: underline;
                color: olive;
            }
            .inputxt
            {
                border-bottom: 0px; border-left: 0px; border-right: 0px; border-top: 0px;
                background-image: url('images/input_bckgr.jpg');  
                background-repeat: no-repeat;
                height: 18px;
                width: 200px;
                padding-top: 2px;
                padding-left: 4px;
                color: #5F5F5F;
            }
            .input_text
            {
                width: 240px; height: 55px;
            }
            .input_text-btn
            {
                width: 200px; height: 55px;text-align: right;
            }
            
            
            
            #top
            {
                  width: 495px;
                  height: 143px;
                  overflow: hidden;
            }
            #boton
            {
                  width: 495px;
                  height: 33px;
                  text-align: right;
            }
            #ranking_actual
            {
                  margin-top: 20px;
                  margin-bottom: 30px;
                  height: 103px;
            }
            #ranking_actual_f1
            {
                  width: 495px;
                  height: 33px;  
            }
            .item_actual
            {
                float: left;
                text-align: left;
                width: 98px;
                height: 70px;
                overflow: hidden;
            }
            .btn_link
            {
                float: left;
                width: 150px;
                height: 64px;
                margin-right: 13px;
            }
        </style>
        <script type="text/javascript">
            $(document).ready(function () {
                $("#tabs").tabs();
            });

            function updateStatus(){
                var status  =   document.getElementById('status').value;
                
                $.ajax({
                    type: "POST",
                    url: "<?=$fbconfig['baseUrl']?>/ajax.php",
                    data: "status=" + status,
                    success: function(msg){
                        alert(msg);
                    },
                    error: function(msg){
                        alert(msg);
                    }
                });
            }
            function updateStatusViaJavascriptAPICalling(){
                var status  =   document.getElementById('status').value;
                    FB.api('/me/feed', 'post', { message: status }, function(response) {
                        if (!response || response.error) {
                             alert('Error occured');
                        } else {
                             alert('Status updated Successfully');
                        }
                   });
            }
            function streamPublish(name, description, hrefTitle, hrefLink, userPrompt){        
                FB.ui({ method : 'feed', 
                        message: userPrompt,
                        link   :  hrefLink,
                        caption:  hrefTitle
                      });
                    //http://developers.facebook.com/docs/reference/dialogs/feed/
            }
            function publishStream(){
                streamPublish("Stream Publish", 'Thinkdiff.net is simply awesome. I just learned how to develop Iframe+Jquery+Ajax base facebook application development using php sdk 3.0. ', 'Checkout the Tutorial', 'http://wp.me/pr3EW-sv', "Demo Facebook Application Tutorial");
            }
            function increaseIframeSize(w,h){
                var obj =   new Object;
                obj.width=w;
                obj.height=h;
                FB.Canvas.setSize(obj);
            }

            function newInvite(){
                 var receiverUserIds = FB.ui({ 
                        method : 'apprequests',
                        message: 'come on man checkout my application. visit http://thinkdiff.net',
                 },
                 function(receiverUserIds) {
                          console.log("IDS : " + receiverUserIds.request_ids);
                        }
                 );
                 //http://developers.facebook.com/docs/reference/dialogs/requests/
            }
            
            
            
            
            function grabar()
            {
             
                 if(form.nombre.value == "")
                 {
                     alert("Ingrese Nombre");
                     exit;
                 }

                 if(form.apaterno.value == "")
                 {
                     alert("Ingrese Apellido Paterno");
                     exit;
                 }

                 if(form.amaterno.value == "")
                 {
                     alert("Ingrese Apellido Materno");
                     exit;
                 }
                 
                 if(form.dni.value == "" || (!/^([0-9])*$/.test(form.dni.value)))
                 {
                     alert("Ingrese DNI");
                     exit;
                 }                                 

                 if(form.fono.value == "" || (!/^([0-9])*$/.test(form.fono.value)))
                 {
                    alert("Ingrese Teléfono");
                    exit;                    
                 }

                 if(form.celular.value == "" || (!/^([0-9])*$/.test(form.celular.value)))
                 {
                    alert("Ingrese Celular");
                    exit;                    
                 }

                  if(form.mail.value == "")
                 {
                     alert("Ingrese Email");
                     exit;
                 }

                 
                 
                 


                    //Grabar en BD
                   $.post("grabar.php",{
                       var_nombre:form.nombre.value,
                       var_paterno:form.apaterno.value,
                       var_dni:form.dni.value,
                       var_fono:form.fono.value,
                       var_mail:form.mail.value,
                       var_materno:form.amaterno.value,
                       var_cel:form.celular.value
                   }, function() 
                   { 
                       $("#footer").html("Gracias, su solicitud ha sido enviada");
                       top.location.href = "http://www.facebook.com/DinersClubPeru"; 
                   });
                   
                   
            }            
        </script>
    </head>
<body>
    <div id="fb-root"></div>
    <script type="text/javascript" src="https://connect.facebook.net/es_LA/all.js"></script>
     <script type="text/javascript">
       FB.init({
         appId  : '<?=$fbconfig['appid']?>',
         status : true, // check login status
         cookie : true, // enable cookies to allow the server to access the session
         xfbml  : true  // parse XFBML
       });
       
     </script>
   
     <div id="contenedor">
         <div id="top">
             <img src="images/gmv5_top.jpg" border="0" alt="" title="" />
         </div> 
         <div id="boton">
             <a href="index2.php"><img src="images/gmv5_boton1.jpg" alt="Click y Participa" title="Click y Participa" border="0" /></a>
         </div>
         <div id="texto1">
             <img src="images/gmv5_texto1.png" alt="" title="" border="0" />
         </div>
         <div id="ranking_actual">
             <div id="ranking_actual_f1">
                 <img src="images/gmv5_texto2.png" alt="" title="" border="0" />
             </div>
            <!--MOSTRAR RANKING DINAMICO-->             
             <div id="ranking_actual_f2">

<?php
                $sql_verificar2 = "SELECT nombre from gmv_top5 ORDER BY puntaje DESC";
                $result2 = mysql_query($sql_verificar2);
                while ($row2 = mysql_fetch_array($result2))
                {
                    //echo $row2["nombre"].'.jpg'; echo '<br/>';
                    echo '<div class="item_actual">';
                    echo  '<img src="images/'.$row2["nombre"].'.jpg'.'" alt="" title="" border="0" />';
                    echo '</div>';                    
                }
?>                 
             </div>
            <!--END MOSTRAR RANKING DINAMICO-->             
         </div>
         <div class="linea_div">
             <img src="images/gmv5_linea1.jpg" alt="" title="" border="0" />
         </div>
         <div id="boton2">
             <div class="btn_link">
                 <a href="http://www.gmv.com.pe/es/plus.asp" target="_blank"><img src="images/gmv5_boton2.jpg" alt="" title="" border="0" /></a>
             </div>
             <div class="btn_link">
                 <a href="http://www.gmv.com.pe/es/gestion_social2.asp" target="_blank"><img src="images/gmv5_boton3.jpg" alt="" title="" border="0" /></a>
             </div>
             <div class="btn_link">
                 <a href="http://www.gmv.com.pe/es/proyectos.asp" target="_blank"><img src="images/gmv5_boton4.jpg" alt="" title="" border="0" /></a>
             </div>
         </div>
         
     </div>
     
     
     
     
     
     
     
     
    <?php

     //var_dump($userInfo); 
    ?>
     
     
    
    
    
    <script type="text/javascript">
    increaseIframeSize(495, 900);
    </script>
     
</body>
</html>